/****************************************************************************
**CAN设备的发送进程
**
**
****************************************************************************/
#include "cansdthread.h"
#include "QDebug"
#include "equ_include/ECS_FCC300.h"


//CAN_send_control_0,CAN_send_control_1，CAN_send_control_2可以用来控制发送的开启和关闭

CanSDThread::CanSDThread(QObject *Parent):
    QThread(Parent)
{  cansed_sign=0; }

void CanSDThread::run()
{

    while(1)
    {
        msleep(50);
        time_50ms++;
        if(time_50ms%1==0)  //50ms的周期
        {
            //BTMS_CONTROLLER::BTMS_Controller_0x0C10B201_MA();
            //BTMS_CONTROLLER::BTMS_Controller_0x0C10B202_MA();
            // BTMS_CONTROLLER::BTMS_Controller_0x0C20B201_MA();
            //Transmit(4, 0,0, &BTMS_MA_0C10B201, 1);
            //Transmit(4, 0,0, &BTMS_MA_0C10B202, 1);
            //Transmit(4, 0,0, &BTMS_MA_0C20B201, 1);
            //Transmit(设备类型号,设备索引号,第几路CAN, 要发送的数据帧数组的首指针, 要发送的数据帧数组的长度) 路数0为硬件上CAN1



        }
        if(time_50ms%2==0)  //100ms的周期 
        {
            if(CAN_send_control_0==1)
            {
                qDebug()<<"CAN发送";
                ECS_FCC300::EQ_0x0C01C1A7_MA();
                Transmit(4, 0,0, &ECS_FCC300_MA_0C01C1A7, 1);

            }


        }
        if(time_50ms%4==0)  //200ms的周期
        {}

        if(time_50ms%10==0)  //500ms的周期
        {
            if(CAN_send_control_0==1)
            {


            }

        }
        if(time_50ms%20==0)  //1s的周期
        {

        }

        if(time_50ms>=20)
        {
            time_50ms=0;
        }
    }
}

